﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.SqlClient;
using System.Data;
namespace TDT_Project.classes
{
    public class cls_phuhuynhxemdiem
    {
        //string _NienHoc_id = "";

        //public string NienHoc_id
        //{
        //    get { return _NienHoc_id; }Cap
        //    set { _NienHoc_id = value; }
        //}
        //string _TenNienHoc = "";

        //public string TenNienHoc
        //{
        //    get { return _TenNienHoc; }
        //    set { _TenNienHoc = value; }
        //}
        //DateTime _NgayBatDau = DateTime.Now;

        //public DateTime NgayBatDau
        //{
        //    get { return _NgayBatDau; }
        //    set { _NgayBatDau = value; }
        //}

        //DateTime _NgayKetThuc = DateTime.Now;

        //public DateTime NgayKetThuc
        //{
        //    get { return _NgayKetThuc; }
        //    set { _NgayKetThuc = value; }
        //}
        public DataSet Get_Mon()
        {
            DataSet results = new DataSet();
            SqlConnection oConnection = new SqlConnection(cls_config.ConnectionString);
            SqlCommand oCommand = new SqlCommand("Get_Mon", oConnection);
            oCommand.CommandType = CommandType.StoredProcedure;
            SqlDataAdapter da = new SqlDataAdapter();
            da.SelectCommand = oCommand;
            da.Fill(results);
            oConnection.Close();
            oConnection.Dispose();
            oConnection = null;
            return results;

        }
        public DataSet Get_Khoi()
        {
            DataSet results = new DataSet();
            SqlConnection oConnection = new SqlConnection(cls_config.ConnectionString);
            SqlCommand oCommand = new SqlCommand("Get_Khoi", oConnection);
            oCommand.CommandType = CommandType.StoredProcedure;
            SqlDataAdapter da = new SqlDataAdapter();
            da.SelectCommand = oCommand;
            da.Fill(results);
            oConnection.Close();
            oConnection.Dispose();
            oConnection = null;
            return results;

        }
        public DataSet Get_Diem_HS(string HocKy, string NienHoc, string HocSinhID, string lop)
        {
            try
            {
                DataSet results = new DataSet();
                SqlConnection oConnection = new SqlConnection(cls_config.ConnectionString);
                SqlCommand oCommand = new SqlCommand("Get_Diem_HS", oConnection);
                oCommand.CommandType = CommandType.StoredProcedure;
                oCommand.Parameters.Add("@HocKy", SqlDbType.NVarChar).Value = HocKy;
                oCommand.Parameters.Add("@NienHoc", SqlDbType.NVarChar).Value = NienHoc;
                oCommand.Parameters.Add("@HocSinhID", SqlDbType.NVarChar).Value = HocSinhID;
                oCommand.Parameters.Add("@Lop", SqlDbType.NVarChar).Value = lop;
                SqlDataAdapter da = new SqlDataAdapter();
                da.SelectCommand = oCommand;
                da.Fill(results);
                oConnection.Close();
                oConnection.Dispose();
                oConnection = null;
                if (results != null && results.Tables.Count > 0)
                    if (results.Tables[0].Rows.Count > 0)
                    {
                        for (int i = 0; i < results.Tables[0].Rows.Count; i++)
                        {
                            if (results.Tables[0].Rows[i][2].ToString() == "MH12")
                            {
                                for (int j = 3; j < results.Tables[0].Columns.Count; j++)
                                    if (results.Tables[0].Rows[i][j].ToString() == "")
                                        results.Tables[0].Rows[i][j] = "CĐ";
                                    else
                                        if (Convert.ToDecimal(results.Tables[0].Rows[i][j]) < 5)
                                            results.Tables[0].Rows[i][j] = "CĐ";
                                        else
                                            results.Tables[0].Rows[i][j] = "Đ";
                            }
                        }
                    }
                return results;
            }
            catch (Exception)
            {

                throw;
            }


        }
        public DataSet Get_NhanXet(string HocKy, string NienHoc, string HocSinhID, string lop, int loai)
        {
            try
            {
                DataSet results = new DataSet();
                SqlConnection oConnection = new SqlConnection(cls_config.ConnectionString);
                SqlCommand oCommand = new SqlCommand("Get_NhanXet", oConnection);
                oCommand.CommandType = CommandType.StoredProcedure;
                oCommand.Parameters.Add("@HocSinh_ID", SqlDbType.NVarChar).Value = HocSinhID;
                oCommand.Parameters.Add("@Lop_Id", SqlDbType.NVarChar).Value = lop;
                oCommand.Parameters.Add("@NienHoc_id", SqlDbType.NVarChar).Value = NienHoc;
                oCommand.Parameters.Add("@HocKy_ID", SqlDbType.NVarChar).Value = HocKy;
                oCommand.Parameters.Add("@Loai_NX", SqlDbType.Int).Value = loai;
                SqlDataAdapter da = new SqlDataAdapter();
                da.SelectCommand = oCommand;
                da.Fill(results);
                oConnection.Close();
                oConnection.Dispose();
                oConnection = null;
                return results;
            }
            catch (Exception)
            {

                throw;
            }


        }
        public DataSet Get_DAKT_ID(int ID)
        {
            try
            {
                DataSet results = new DataSet();
                SqlConnection oConnection = new SqlConnection(cls_config.ConnectionString);
                SqlCommand oCommand = new SqlCommand("Get_DAKT_ID", oConnection);
                oCommand.CommandType = CommandType.StoredProcedure;               
                oCommand.Parameters.Add("@ID", SqlDbType.Int).Value = ID;
                SqlDataAdapter da = new SqlDataAdapter();
                da.SelectCommand = oCommand;
                da.Fill(results);
                oConnection.Close();
                oConnection.Dispose();
                oConnection = null;
                return results;
            }
            catch (Exception)
            {

                throw;
            }


        }
        public DataSet Get_DAKT(string NienHoc, string KhoiID, string MonID)
        {
            try
            {
                DataSet results = new DataSet();
                SqlConnection oConnection = new SqlConnection(cls_config.ConnectionString);
                SqlCommand oCommand = new SqlCommand("Get_DAKT", oConnection);
                oCommand.CommandType = CommandType.StoredProcedure;
                oCommand.Parameters.Add("@NienHoc_ID", SqlDbType.NVarChar).Value = NienHoc;
                oCommand.Parameters.Add("@Khoi_ID", SqlDbType.NVarChar).Value = KhoiID;
                oCommand.Parameters.Add("@Mon_ID", SqlDbType.NVarChar).Value = MonID;
                SqlDataAdapter da = new SqlDataAdapter();
                da.SelectCommand = oCommand;
                da.Fill(results);
                oConnection.Close();
                oConnection.Dispose();
                oConnection = null;
                return results;
            }
            catch (Exception)
            {

                throw;
            }


        }
        public DataSet Get_DAKT_Mon(string NienHoc, string KhoiID, string MonID,int pagesize,int pagenumber)
        {
            try
            {
                DataSet results = new DataSet();
                SqlConnection oConnection = new SqlConnection(cls_config.ConnectionString);
                SqlCommand oCommand = new SqlCommand("Get_DAKT_Mon", oConnection);
                oCommand.CommandType = CommandType.StoredProcedure;
                oCommand.Parameters.Add("@NienHoc_ID", SqlDbType.NVarChar).Value = NienHoc;
                oCommand.Parameters.Add("@Khoi_ID", SqlDbType.NVarChar).Value = KhoiID;
                oCommand.Parameters.Add("@Mon_ID", SqlDbType.NVarChar).Value = MonID;
                oCommand.Parameters.Add("@PageNumber", SqlDbType.Int).Value = pagenumber;
                oCommand.Parameters.Add("@PageSize", SqlDbType.Int).Value = pagesize;
                SqlDataAdapter da = new SqlDataAdapter();
                da.SelectCommand = oCommand;
                da.Fill(results);
                oConnection.Close();
                oConnection.Dispose();
                oConnection = null;
                return results;
            }
            catch (Exception)
            {

                throw;
            }


        }
        public DataSet Get_NhanXet_HS_Admin(string HocKy, string NienHoc, string lop)
        {
            try
            {
                DataSet results = new DataSet();
                SqlConnection oConnection = new SqlConnection(cls_config.ConnectionString);
                SqlCommand oCommand = new SqlCommand("Get_NhanXet_HS_Admin", oConnection);
                oCommand.CommandType = CommandType.StoredProcedure;               
                oCommand.Parameters.Add("@Lop_Id", SqlDbType.NVarChar).Value = lop;
                oCommand.Parameters.Add("@NienHoc_id", SqlDbType.NVarChar).Value = NienHoc;
                oCommand.Parameters.Add("@HocKy_ID", SqlDbType.NVarChar).Value = HocKy;               
                SqlDataAdapter da = new SqlDataAdapter();
                da.SelectCommand = oCommand;
                da.Fill(results);
                oConnection.Close();
                oConnection.Dispose();
                oConnection = null;
                return results;
            }
            catch (Exception)
            {

                throw;
            }


        }
        public DataSet Get_NhanXet_GV_Admin(string HocKy, string NienHoc, string lop)
        {
            try
            {
                DataSet results = new DataSet();
                SqlConnection oConnection = new SqlConnection(cls_config.ConnectionString);
                SqlCommand oCommand = new SqlCommand("Get_NhanXet_GV_Admin", oConnection);
                oCommand.CommandType = CommandType.StoredProcedure;
                oCommand.Parameters.Add("@Lop_Id", SqlDbType.NVarChar).Value = lop;
                oCommand.Parameters.Add("@NienHoc_id", SqlDbType.NVarChar).Value = NienHoc;
                oCommand.Parameters.Add("@HocKy_ID", SqlDbType.NVarChar).Value = HocKy;
                SqlDataAdapter da = new SqlDataAdapter();
                da.SelectCommand = oCommand;
                da.Fill(results);
                oConnection.Close();
                oConnection.Dispose();
                oConnection = null;
                return results;
            }
            catch (Exception)
            {

                throw;
            }


        }
        public DataSet Get_Log_Diem(string HocKy, string NienHoc, DateTime date)
        {
            try
            {
                DataSet results = new DataSet();
                SqlConnection oConnection = new SqlConnection(cls_config.ConnectionString);
                SqlCommand oCommand = new SqlCommand("Get_Log_Diem", oConnection);
                oCommand.CommandType = CommandType.StoredProcedure;
               // oCommand.Parameters.Add("@HocSinh_ID", SqlDbType.NVarChar).Value = HocSinhID;
               // oCommand.Parameters.Add("@Lop", SqlDbType.NVarChar).Value = lop;               
                oCommand.Parameters.Add("@HocKy", SqlDbType.NVarChar).Value = HocKy;
                oCommand.Parameters.Add("@NienHoc", SqlDbType.NVarChar).Value = NienHoc;
                oCommand.Parameters.Add("@Date", SqlDbType.DateTime).Value = date;
                SqlDataAdapter da = new SqlDataAdapter();
                da.SelectCommand = oCommand;
                da.Fill(results);
                oConnection.Close();
                oConnection.Dispose();
                oConnection = null;
                return results;
            }
            catch (Exception)
            {

                throw;
            }


        }
        public DataSet Get_ThongTin_HS(string lop, string NienHoc, string HocSinhID)
        {
            try
            {
                DataSet results = new DataSet();
                SqlConnection oConnection = new SqlConnection(cls_config.ConnectionString);
                SqlCommand oCommand = new SqlCommand("Get_HSbyID", oConnection);
                oCommand.CommandType = CommandType.StoredProcedure;
                oCommand.Parameters.Add("@HSID", SqlDbType.NVarChar).Value = HocSinhID;
                oCommand.Parameters.Add("@Lop", SqlDbType.NVarChar).Value = lop;
                oCommand.Parameters.Add("@NienKhoa", SqlDbType.NVarChar).Value = NienHoc;
                SqlDataAdapter da = new SqlDataAdapter();
                da.SelectCommand = oCommand;
                da.Fill(results);
                oConnection.Close();
                oConnection.Dispose();
                oConnection = null;
                return results;
            }
            catch (Exception)
            {

                throw;
            }


        }
        public DataSet GET_KQ_CANAM(string lop, string NienHoc, string HocSinhID)
        {
            try
            {
                DataSet results = new DataSet();
                SqlConnection oConnection = new SqlConnection(cls_config.ConnectionString);
                SqlCommand oCommand = new SqlCommand("GET_KQ_CANAM", oConnection);
                oCommand.CommandType = CommandType.StoredProcedure;
                oCommand.Parameters.Add("@NienHoc", SqlDbType.NVarChar).Value = NienHoc;
                oCommand.Parameters.Add("@HocSinhID", SqlDbType.NVarChar).Value = HocSinhID;
                oCommand.Parameters.Add("@Lop", SqlDbType.NVarChar).Value = lop;
                SqlDataAdapter da = new SqlDataAdapter();
                da.SelectCommand = oCommand;
                da.Fill(results);
                oConnection.Close();
                oConnection.Dispose();
                oConnection = null;
                return results;
            }
            catch (Exception)
            {

                throw;
            }


        }
        public DataSet Get_ViPham(string hk, string NienHoc, string HocSinhID)
        {
            try
            {
                DataSet results = new DataSet();
                SqlConnection oConnection = new SqlConnection(cls_config.ConnectionString);
                SqlCommand oCommand = new SqlCommand("Get_ViPham", oConnection);
                oCommand.CommandType = CommandType.StoredProcedure;
                oCommand.Parameters.Add("@HocKy", SqlDbType.NVarChar).Value = hk;
                oCommand.Parameters.Add("@NienHoc", SqlDbType.NVarChar).Value = NienHoc;
                oCommand.Parameters.Add("@HocSinhID", SqlDbType.NVarChar).Value = HocSinhID;
                SqlDataAdapter da = new SqlDataAdapter();
                da.SelectCommand = oCommand;
                da.Fill(results);
                oConnection.Close();
                oConnection.Dispose();
                oConnection = null;
                return results;
            }
            catch (Exception)
            {

                throw;
            }


        }
        public DataSet Check_ThiLai(string NienHoc, string HocSinhID)
        {
            try
            {
                DataSet results = new DataSet();
                SqlConnection oConnection = new SqlConnection(cls_config.ConnectionString);
                SqlCommand oCommand = new SqlCommand("Check_ThiLai", oConnection);
                oCommand.CommandType = CommandType.StoredProcedure;              
                oCommand.Parameters.Add("@NienHoc", SqlDbType.NVarChar).Value = NienHoc;
                oCommand.Parameters.Add("@HocSinhID", SqlDbType.NVarChar).Value = HocSinhID;
                SqlDataAdapter da = new SqlDataAdapter();
                da.SelectCommand = oCommand;
                da.Fill(results);
                oConnection.Close();
                oConnection.Dispose();
                oConnection = null;
                return results;
            }
            catch (Exception)
            {

                throw;
            }


        }
        public DataSet Get_HOCLUC_HS(string lop, string NienHoc, string HocSinhID, string hocky)
        {
            try
            {
                DataSet results = new DataSet();
                SqlConnection oConnection = new SqlConnection(cls_config.ConnectionString);
                SqlCommand oCommand = new SqlCommand("Get_KQHS", oConnection);
                oCommand.CommandType = CommandType.StoredProcedure;
                oCommand.Parameters.Add("@HocKy", SqlDbType.NVarChar).Value = hocky;
                oCommand.Parameters.Add("@NienHoc", SqlDbType.NVarChar).Value = NienHoc;
                oCommand.Parameters.Add("@HocSinhID", SqlDbType.NVarChar).Value = HocSinhID;
                oCommand.Parameters.Add("@Lop", SqlDbType.NVarChar).Value = lop;
                SqlDataAdapter da = new SqlDataAdapter();
                da.SelectCommand = oCommand;
                da.Fill(results);
                oConnection.Close();
                oConnection.Dispose();
                oConnection = null;
                return results;
            }
            catch (Exception)
            {

                throw;
            }


        }

        public DataSet Get_Thong_Tin_Hoc_Nhan_Xet(string NienHoc_ID, string GiaoVien_Id)
        {
            try
            {
                DataSet results = new DataSet();
                SqlConnection oConnection = new SqlConnection(cls_config.ConnectionString);
                SqlCommand oCommand = new SqlCommand("Get_Thong_Tin_Hoc_Nhan_Xet", oConnection);
                oCommand.CommandType = CommandType.StoredProcedure;
                oCommand.Parameters.Add("@prNienHoc_ID", SqlDbType.NVarChar).Value = NienHoc_ID;
                oCommand.Parameters.Add("@prGiaoVien_Id", SqlDbType.NVarChar).Value = GiaoVien_Id;
                SqlDataAdapter da = new SqlDataAdapter();
                da.SelectCommand = oCommand;
                da.Fill(results);
                oConnection.Close();
                oConnection.Dispose();
                oConnection = null;
                return results;

            }
            catch (Exception)
            {
                throw;
            }
        }


        public DataSet Get_gv_day(string HocKy, string NienHoc, string lop)
        {
            try
            {
                DataSet results = new DataSet();
                SqlConnection oConnection = new SqlConnection(cls_config.ConnectionString);
                SqlCommand oCommand = new SqlCommand("Get_GV_GIANGDAY", oConnection);

                oCommand.CommandType = CommandType.StoredProcedure;
                oCommand.Parameters.Add("@HocKy", SqlDbType.NVarChar).Value = HocKy;
                oCommand.Parameters.Add("@NienHoc", SqlDbType.NVarChar).Value = NienHoc;
                oCommand.Parameters.Add("@Lop", SqlDbType.NVarChar).Value = lop;
                SqlDataAdapter da = new SqlDataAdapter();
                da.SelectCommand = oCommand;
                da.Fill(results);
                oConnection.Close();
                oConnection.Dispose();
                oConnection = null;
                return results;

            }
            catch (Exception)
            {

                throw;
            }

        }

        public DataSet Get_Nhan_Xet(string HocSinh_ID)
        {
            try
            {
                DataSet results = new DataSet();
                SqlConnection oConnection = new SqlConnection(cls_config.ConnectionString);
                SqlCommand oCommand = new SqlCommand("Get_Nhan_Xet", oConnection);
                oCommand.CommandType = CommandType.StoredProcedure;
                oCommand.Parameters.Add("@prHocSinh_ID", SqlDbType.NVarChar).Value = HocSinh_ID;
                SqlDataAdapter da = new SqlDataAdapter();
                da.SelectCommand = oCommand;
                da.Fill(results);
                oConnection.Close();
                oConnection.Dispose();
                oConnection = null;
                return results;
            }
            catch (Exception)
            {

                throw;
            }
        }

        public bool Insert_NhanXet(string @Lop_Id, string @NienHoc_id, string @HocKy_ID,
            DateTime @Ngay_Gui, string @Noi_Dung, int @Loai_NX, string @hocsinh)
        {

            SqlConnection oConnection = new SqlConnection(cls_config.ConnectionString);
            SqlCommand oCommand = new SqlCommand("Insert_NhanXet", oConnection);
            oCommand.CommandType = CommandType.StoredProcedure;
            oCommand.Parameters.Add("@HocSinh_ID", SqlDbType.NChar).Value = @hocsinh;
            oCommand.Parameters.Add("@Lop_Id", SqlDbType.NChar).Value = @Lop_Id;
            oCommand.Parameters.Add("@NienHoc_id", SqlDbType.NChar).Value = @NienHoc_id;
            oCommand.Parameters.Add("@HocKy_ID", SqlDbType.NChar).Value = @HocKy_ID;

            oCommand.Parameters.Add("@Ngay_Gui", SqlDbType.DateTime).Value = @Ngay_Gui;
            oCommand.Parameters.Add("@Noi_Dung", SqlDbType.NChar).Value = @Noi_Dung;
            oCommand.Parameters.Add("@Loai_NX", SqlDbType.Int).Value = @Loai_NX;

            bool bReturn = false;
            try
            {
                oConnection.Open();
                oCommand.ExecuteNonQuery();
                bReturn = true;
            }
            catch
            {
                return bReturn;
            }
            oConnection.Close();
            oConnection.Dispose();
            oConnection = null;
            return bReturn;
        }
        public bool Insert_DAKT(string @NienHoc_ID, string @Khoi_ID, string @Mon_ID,
           DateTime @NgayDang, string @TieuDe, string @NoiDung, string @FileURL)
        {

            SqlConnection oConnection = new SqlConnection(cls_config.ConnectionString);
            SqlCommand oCommand = new SqlCommand("Insert_DAKT", oConnection);
            oCommand.CommandType = CommandType.StoredProcedure;
            oCommand.Parameters.Add("@NienHoc_ID", SqlDbType.NVarChar).Value = @NienHoc_ID;
            oCommand.Parameters.Add("@Khoi_ID", SqlDbType.NVarChar).Value = @Khoi_ID;
            oCommand.Parameters.Add("@Mon_ID", SqlDbType.NVarChar).Value = @Mon_ID;
            oCommand.Parameters.Add("@TieuDe", SqlDbType.NVarChar).Value = @TieuDe;
            oCommand.Parameters.Add("@NgayDang", SqlDbType.DateTime).Value = @NgayDang;
            oCommand.Parameters.Add("@NoiDung", SqlDbType.NText).Value = @NoiDung;
            oCommand.Parameters.Add("@FileURL", SqlDbType.NVarChar).Value = @FileURL;

            bool bReturn = false;
            try
            {
                oConnection.Open();
                oCommand.ExecuteNonQuery();
                bReturn = true;
            }
            catch
            {
                return bReturn;
            }
            oConnection.Close();
            oConnection.Dispose();
            oConnection = null;
            return bReturn;
        }
        public bool Update_DAKT(string @NienHoc_ID, string @Khoi_ID, string @Mon_ID,
       DateTime @NgayDang, string @TieuDe, string @NoiDung, string @FileURL,Int32 @ID)
        {

            SqlConnection oConnection = new SqlConnection(cls_config.ConnectionString);
            SqlCommand oCommand = new SqlCommand("Update_DAKT", oConnection);
            oCommand.CommandType = CommandType.StoredProcedure;
            oCommand.Parameters.Add("@NienHoc_ID", SqlDbType.NVarChar).Value = @NienHoc_ID;
            oCommand.Parameters.Add("@Khoi_ID", SqlDbType.NVarChar).Value = @Khoi_ID;
            oCommand.Parameters.Add("@Mon_ID", SqlDbType.NVarChar).Value = @Mon_ID;
            oCommand.Parameters.Add("@TieuDe", SqlDbType.NVarChar).Value = @TieuDe;
            oCommand.Parameters.Add("@NgayDang", SqlDbType.DateTime).Value = @NgayDang;
            oCommand.Parameters.Add("@NoiDung", SqlDbType.NText).Value = @NoiDung;
            oCommand.Parameters.Add("@FileURL", SqlDbType.NVarChar).Value = @FileURL;
            oCommand.Parameters.Add("@ID", SqlDbType.BigInt).Value = @ID;
            bool bReturn = false;
            try
            {
                oConnection.Open();
                oCommand.ExecuteNonQuery();
                bReturn = true;
            }
            catch
            {
                return bReturn;
            }
            oConnection.Close();
            oConnection.Dispose();
            oConnection = null;
            return bReturn;
        }
        public bool Xoa_DAKT( Int32 @ID)
        {

            SqlConnection oConnection = new SqlConnection(cls_config.ConnectionString);
            SqlCommand oCommand = new SqlCommand("Xoa_DAKT", oConnection);
            oCommand.CommandType = CommandType.StoredProcedure;           
            oCommand.Parameters.Add("@ID", SqlDbType.BigInt).Value = @ID;
            bool bReturn = false;
            try
            {
                oConnection.Open();
                oCommand.ExecuteNonQuery();
                bReturn = true;
            }
            catch
            {
                return bReturn;
            }
            oConnection.Close();
            oConnection.Dispose();
            oConnection = null;
            return bReturn;
        }

        public bool Insert_Log(string @HocSinh_ID, string @Lop_ID, string @HocKy_ID, string @NienHoc_ID, string @SDT, string @SDT_OUT,
          DateTime @Ngay)
        {

            SqlConnection oConnection = new SqlConnection(cls_config.ConnectionString);
            SqlCommand oCommand = new SqlCommand("Insert_Log", oConnection);
            oCommand.CommandType = CommandType.StoredProcedure;
            oCommand.Parameters.Add("@HocSinh_ID", SqlDbType.NChar).Value = @HocSinh_ID;
            oCommand.Parameters.Add("@Lop_ID", SqlDbType.NChar).Value = @Lop_ID;
            oCommand.Parameters.Add("@HocKy_ID", SqlDbType.NChar).Value = @HocKy_ID;
            oCommand.Parameters.Add("@NienHoc_ID", SqlDbType.NChar).Value = @NienHoc_ID;
            oCommand.Parameters.Add("@SDT", SqlDbType.NChar).Value = @SDT;
            oCommand.Parameters.Add("@SDT_OUT", SqlDbType.NChar).Value = @SDT_OUT;
            oCommand.Parameters.Add("@Ngay", SqlDbType.DateTime).Value = @Ngay;
            bool bReturn = false;
            try
            {
                oConnection.Open();
                oCommand.ExecuteNonQuery();
                bReturn = true;
            }
            catch
            {
                return bReturn;
            }
            oConnection.Close();
            oConnection.Dispose();
            oConnection = null;
            return bReturn;
        }
       
        public bool Delete_Log(string @ID)
        {

            SqlConnection oConnection = new SqlConnection(cls_config.ConnectionString);
            SqlCommand oCommand = new SqlCommand("Xoa_LSDN", oConnection);
            oCommand.CommandType = CommandType.StoredProcedure;
            oCommand.Parameters.Add("@ID", SqlDbType.VarChar).Value = @ID;           
            bool bReturn = false;
            try
            {
                oConnection.Open();
                oCommand.ExecuteNonQuery();
                bReturn = true;
            }
            catch
            {
                return bReturn;
            }
            oConnection.Close();
            oConnection.Dispose();
            oConnection = null;
            return bReturn;
        }
        public bool Delete_NhanXet(string @ID)
        {

            SqlConnection oConnection = new SqlConnection(cls_config.ConnectionString);
            SqlCommand oCommand = new SqlCommand("Xoa_NhanXet", oConnection);
            oCommand.CommandType = CommandType.StoredProcedure;
            oCommand.Parameters.Add("@ID", SqlDbType.Int).Value =Int32.Parse(@ID);
            bool bReturn = false;
            try
            {
                oConnection.Open();
                oCommand.ExecuteNonQuery();
                bReturn = true;
            }
            catch
            {
                return bReturn;
            }
            oConnection.Close();
            oConnection.Dispose();
            oConnection = null;
            return bReturn;
        }
        public DataSet TOAN_Get_Thong_Tin_Nhan_Xet(string HocSinh_ID, string Lop_Id, string NienHoc_id, string HocKy_ID, int Loai_NX)
        {
            try
            {
                DataSet results = new DataSet();
                SqlConnection oConnection = new SqlConnection(cls_config.ConnectionString);
                SqlCommand oCommand = new SqlCommand("TOAN_Get_Thong_Tin_Nhan_Xet", oConnection);
                oCommand.CommandType = CommandType.StoredProcedure;
                oCommand.Parameters.Add("@HocSinh_ID", SqlDbType.NVarChar).Value = HocSinh_ID;
                oCommand.Parameters.Add("@Lop_Id", SqlDbType.NVarChar).Value = Lop_Id;
                oCommand.Parameters.Add("@NienHoc_id", SqlDbType.NVarChar).Value = NienHoc_id;
                oCommand.Parameters.Add("@HocKy_ID", SqlDbType.NVarChar).Value = HocKy_ID;
                oCommand.Parameters.Add("@Loai_NX", SqlDbType.Int).Value = Loai_NX;
                SqlDataAdapter da = new SqlDataAdapter();
                da.SelectCommand = oCommand;
                da.Fill(results);
                oConnection.Close();
                oConnection.Dispose();
                oConnection = null;
                return results;
            }
            catch (Exception)
            {

                throw;
            }
        }


    }
}